// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2007-9-15 18:54:19

// Source File Name:   r4.java

package com.zelix;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.*;

//            oc, pz, qz

public class r4 extends JTextField
        implements ActionListener, PropertyChangeListener, DocumentListener, pz {

    private File a;
    private int b;
    private boolean c;
    private Document d;
    private boolean e;
    private File f[];
    private static String g;
    private static String z[];

    public r4(File file, boolean flag, int i, boolean flag1) {
        a = file;
        d = new PlainDocument();
        setDocument(d);
        d.addDocumentListener(this);
        setEditable(flag);
        b = i;
        c = flag1;
        addActionListener(this);
        setText("");
    }

    public void actionPerformed(ActionEvent actionevent) {
        if (b == 1 || b == 3)
            firePropertyChange(z[0], null, a());
    }

    public void changedUpdate(DocumentEvent documentevent) {
        a(documentevent);
    }

    public File a() {
        label0:
        {
            label1:
            {
                File file;
                label2:
                {
                    if (!e)
                        break label0;
                    String s = getText().trim();
                    if (s.length() <= 0)
                        break label1;
                    if (oc.a(s)) {
                        file = new File(a, s);
                        if (qz.a == 0)
                            break label2;
                    }
                    file = new File(s);
                }
                return file;
            }
            return null;
        }
        if (f != null && f.length > 0)
            return f[0];
        else
            return null;
    }

    public File[] b() {
        label0:
        {
            label1:
            {
                File afile[];
                label2:
                {
                    if (!e)
                        break label0;
                    String s = getText().trim();
                    if (s.length() <= 0)
                        break label1;
                    afile = new File[1];
                    if (oc.a(s)) {
                        afile[0] = new File(a, s);
                        if (qz.a == 0)
                            break label2;
                    }
                    afile[0] = new File(s);
                }
                return afile;
            }
            return null;
        }
        return f;
    }

    public void insertUpdate(DocumentEvent documentevent) {
        a(documentevent);
    }

    public void propertyChange(PropertyChangeEvent propertychangeevent) {
        label0:
        {
            if (propertychangeevent.getPropertyName().equals(z[1])) {
                File afile[] = f;
                Object aobj[] = (Object[]) propertychangeevent.getNewValue();
                int i = aobj.length;
                File afile1[] = new File[i];
                System.arraycopy(((Object) (aobj)), 0, afile1, 0, i);
                a(afile1);
                e = false;
                firePropertyChange(z[1], afile, afile1);
                if (qz.a == 0)
                    break label0;
            }
            if (propertychangeevent.getPropertyName().equals(z[2]))
                a = (File) propertychangeevent.getNewValue();
        }
    }

    public void removeUpdate(DocumentEvent documentevent) {
        a(documentevent);
    }

    void a(File file) {
        File afile[] = {
                file
        };
        a(afile);
    }

    private void a(File afile[]) {
        int i;
        ArrayList arraylist;
        StringBuffer stringbuffer;
        int j;
        if (afile == null || afile.length == 0) {
            f = new File[0];
            setText("");
        } else {
            f = afile;
            i = afile.length;
            arraylist = new ArrayList();
            stringbuffer = new StringBuffer();
            for (j = 0; j < i; j++) {
                File file = afile[j];
                if (i > 1)
                    stringbuffer.append(g);
                stringbuffer.append(file.getName());
                if (i > 1)
                    stringbuffer.append(g);
                if (j < i - 1)
                    stringbuffer.append(" ");
                arraylist.add(file);
            }
            f = (File[]) arraylist.toArray(new File[arraylist.size()]);
            setText(stringbuffer.toString());
        }
    }

    public void a(DocumentEvent documentevent) {
        e = true;
        firePropertyChange(z[3], null, getText().trim());
    }

    private static String z(char[] chs) {
        for (int i = 0; i < chs.length; i++) {
            byte key = 0;
            switch (i % 5) {
                case 0:
                    key = 0x6c;
                    break;
                case 1:
                    key = 52;
                    break;
                case 2:
                    key = 113;
                    break;
                case 3:
                    key = 97;
                    break;
                default:
                    key = 99;
                    break;
            }
            chs[i] ^= key;
        }
        return new String(chs).intern();
    }

    static {
        String as[];
        as = new String[4];
        as[0] = "\n]\037\000\017?Q\035\004\000\030]\036\017";
        as[1] = "\037Q\035\004\000\030]\036\017 \004U\037\006\006\b";
        as[2] = "\b]\003\004\000\030[\003\030 \004U\037\006\006\b";
        as[3] = "\n]\035\004-\rY\024\"\013\rZ\026\004\007";
        for (int i = 0; i < as.length; i++) {
            as[i] = z(as[i].toCharArray());
        }
        z = as;

        g = "\"";
    }
}